package com.hgvip.service.impl;

import com.hgvip.common.entity.ResponseData;
import com.hgvip.common.entity.goods.Goods;
import com.hgvip.mapper.GoodsMapper;
import com.hgvip.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by arnold.zhu on 2017/9/25.
 */
@Service("GoodsService")
@Transactional
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public String testSayHello() {
        return "hello";
    }

    @Override
    public ResponseData addGoods(Goods goods) {
        int i = goodsMapper.addGoods(goods);
        if (i == 1) {
            return new ResponseData(200, "insert Success");
        }
        return new ResponseData(400, "insert Failed");
    }

}
